<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function queryParse(urlStr) {
            const reg = new RegExp("(^|&)" + urlStr + "=([^&]*)(&|$)", "i");
            const urlObj = window.location;
            var r = urlStr.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]);
            return null;
        }
        console.log(queryParse("https://www.taobao.com"))
        console.log(queryParse("https://www.taobao.com?a=1&b=2&c=3&d#name"))
    </script>
</body>

</html>